<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:text="${title}"/>
    <meta charset="UTF-8">
</head>
<body>
<strong th:text="${title}"/>
<table>
    <thead>
    <tr>
        <th class="am-hide-sm-only">id</th>
        <th>姓名</th>
    </tr>
    </thead>
    <tbody>
    <tr></tr>
    <tr th:each="employee : ${data}">
        <td th:text="${employee.employeeId}"/>
        <td th:id="${'id'+employee.employeeId}" th:text="${employee.firstName +'  '+ employee.lastName}"
            th:onclick="'clickChangeColor('+${employee.employeeId}+')'"
        />
    </tr>
    </tbody>
</table>
</body>
<script>
    function clickChangeColor(id) {
        document.getElementById("id" + id).style.color = "red"
    }
</script>
</html>